﻿@using EasyCourse.Model;
@using EasyCourse.DB;
@{
    Layout = null;
}
@model UserInfo
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>精品课程管理 个人信息</title>
    @Html.Partial("~/Views/Share/PublicHeader.cshtml")
    <style>
        .uploadify {
            margin: 0 auto;
        }

        .img-thumbnail {
            display: block;
            margin: 10px auto 0;
        }

        legend {
            font-size: 16px;
        }

        .panel-body {
            min-height: 10px;
        }

        .panel {
            margin-bottom: 5px;
        }
    </style>
</head>
<body>
    @Html.Partial("~/Views/Share/PublicTopNav2.cshtml")
    <div class="container">
        <div class="row">
            <h1 class="topTitle-h1">康复治疗微课程网络学习平台<br><small>广州中医药大学康复治疗微课程网络学习平台</small></h1>
        </div>
    </div>
    <div class="container-fluid yue-nav mb15">
        <div class="container">
            <div class="row">
                <ul>
                    <li><a target="_blank" href='@Url.Action("Index","Home")'>课程群首页</a></li>
                    <li><a href="@Url.Action("MyList","Discussion")">论坛讨论</a></li>
                    <li><a href="@Url.Action("List", "StudentResManage")">资源管理</a></li>
                    <li><a class="current" href="javascript:void(0)">个人信息</a></li>
                </ul>
            </div>
        </div>
    </div>
    <div class="container mainwrap mb20">
        <div class="row">
            <div class="col-xs-9 lBox pt15 mainwrap-part">
                <div class="row">
                    <div class="col-xs-3">
                        <img src="@WebSiteDomain.ResFileDomain@Model.Portrait" class="img-thumbnail" id="JPic" width="150" height="150" />
                        <br />
                        <input id="file_upload" name="file_upload" type="file" class="form-control input-sm">
                    </div>
                    <div class="col-xs-9">
                        <div class="panel panel-default">
                            <div class="panel-heading"><h5>个人信息</h5></div>
                            <div class="panel-body">
                                <form role="form">
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2">角色：</label>
                                        <div class="col-xs-10">
                                            <p class="form-control-static input-sm">学生</p>
                                        </div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2">姓名：</label>
                                        <div class="col-xs-10">
                                            <p class="form-control-static input-sm">@Model.RealName</p>
                                        </div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2">已发帖：</label>
                                        <div class="col-xs-10">
                                            <p class="form-control-static input-sm">@Model.DiscussCount</p>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="panel panel-default">
                            <div class="panel-heading"><h5>修改密码</h5></div>
                            <div class="panel-body">
                                <form id="valid_form" role="form">
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2">旧密码:</label>
                                        <div class="col-xs-6">
                                            <input class="form-control input-sm" id="JoPwd" name="oldPass" type="password" />
                                        </div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2">新密码:</label>
                                        <div class="col-xs-6">
                                            <input class="form-control input-sm" id="JnPwd" name="newPass" type="password" />
                                        </div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <label class="control-label col-xs-2">确认新密码:</label>
                                        <div class="col-xs-6">
                                            <input class="form-control input-sm" id="JnPwd2" name="confPass" type="password" />
                                        </div>
                                    </div>
                                    <div class="form-group clearfix">
                                        <div class="col-xs-offset-2 col-xs-10">
                                            <button class="btn btn-success" id="Jchange" type="button">提交</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-3">
                @Html.Partial("~/Views/Share/PublicRBox.cshtml")
            </div>
        </div>
    </div>
    @Html.Partial("~/Views/Share/PublicFooter.cshtml")
    @Html.Partial("~/Views/Share/PublicCommonJs.cshtml")
    <script type="text/javascript" src="../Content/uploadify/jquery.uploadify.min.js?V=@DateTime.Now.Ticks"></script>
    <link href="../Css/uploadify.css" rel="stylesheet" />
    <script type="text/javascript">
        //上传文件
        var _attachmentUrl = null;
        $(function () {
            $("#file_upload").uploadify({
                'queueSizeLimit': 1,
                //fileType代表文件类型的值可能有:   Image 、 OtherFile 、 Temp
                'formData': { 'fileType': 'Image' },
                'buttonText': '请选择图片',
                'swf': '../Content/uploadify/uploadify.swf',
                'uploader': '/Base/UpLoad',
                'onUploadSuccess': function (file, data, response) {
                    var json = $.parseJSON(data);
                    if (json.result) {
                        _attachmentUrl = json.message; //文件保存的地址
                        $.easyPost("/UserInfo/EditPortrait", {
                            "Portrait": _attachmentUrl
                        }, function (data) {
                            if (data.result) {
                                $("#JPic").attr("src", "@WebSiteDomain.ResFileDomain" + _attachmentUrl);
                            } else {
                                showTips.open(data.message)
                            }
                        }, "json")

                    }
                    else {
                        showTips.open(json.message);
                    }
                }
            });
        });
        var JoPwd = $("#JoPwd"),
            JnPwd = $("#JnPwd"),
            JnPwd2 = $("#JnPwd2"),
            Jchange = $("#Jchange");
        Jchange.bind("click", function () {
            $.easyPost("/UserInfo/ChangePassword", {
                "Password": JnPwd.val(),
                "Password2": JnPwd2.val(),
                "OldPassword": JoPwd.val()
            }, function (data) {
                if (data.result) {
                    showTips.open("更改成功！");
                    $("#valid_form")[0].reset()
                } else {
                    showTips.open(data.message)
                }
            }, "json")
        })


    </script>

</body>
</html>